home *** CD-ROM | disk | FTP | other *** search
- unit LVImpl;
-
- interface
-
- uses
- Windows, ActiveX, Classes, Controls, Graphics, Menus, Forms, StdCtrls,
- ComServ, StdVCL, AXCtrls, LVCtrl_TLB, ListView2, ComCtrls, LVItems;
-
- type
- TListViewX = class(TActiveXControl, IListViewX)
- private
- { Private declarations }
- FDelphiControl: TListView2;
- FEvents: IListViewXEvents;
- FItems: IListItems;
- procedure ClickEvent(Sender: TObject);
- procedure DataHintEvent(Sender: TObject; StartIndex, EndIndex: Integer);
- procedure DblClickEvent(Sender: TObject);
- procedure KeyPressEvent(Sender: TObject; var Key: Char);
- procedure ResizeEvent(Sender: TObject);
- protected
- { Protected declarations }
- procedure DefinePropertyPages(DefinePropertyPage: TDefinePropertyPage); override;
- procedure EventSinkChanged(const EventSink: IUnknown); override;
- procedure InitializeControl; override;
- function AlphaSort: WordBool; safecall;
- function ClassNameIs(const Name: WideString): WordBool; safecall;
- function DrawTextBiDiModeFlags(Flags: Integer): Integer; safecall;
- function DrawTextBiDiModeFlagsReadingOnly: Integer; safecall;
- function Get_AllocBy: Integer; safecall;
- function Get_BiDiMode: TxBiDiMode; safecall;
- function Get_BorderStyle: TxBorderStyle; safecall;
- function Get_Checkboxes: WordBool; safecall;
- function Get_Color: OLE_COLOR; safecall;
- function Get_ColumnClick: WordBool; safecall;
- function Get_Ctl3D: WordBool; safecall;
- function Get_Cursor: Smallint; safecall;
- function Get_DoubleBuffered: WordBool; safecall;
- function Get_DragCursor: Smallint; safecall;
- function Get_DragMode: TxDragMode; safecall;
- function Get_Enabled: WordBool; safecall;
- function Get_FlatScrollBars: WordBool; safecall;
- function Get_Font: IFontDisp; safecall;
- function Get_FullDrag: WordBool; safecall;
- function Get_GridLines: WordBool; safecall;
- function Get_HideSelection: WordBool; safecall;
- function Get_HotTrack: WordBool; safecall;
- function Get_MultiSelect: WordBool; safecall;
- function Get_OwnerData: WordBool; safecall;
- function Get_OwnerDraw: WordBool; safecall;
- function Get_ParentColor: WordBool; safecall;
- function Get_ParentFont: WordBool; safecall;
- function Get_ReadOnly: WordBool; safecall;
- function Get_RowSelect: WordBool; safecall;
- function Get_SelCount: Integer; safecall;
- function Get_ShowColumnHeaders: WordBool; safecall;
- function Get_SortType: TxSortType; safecall;
- function Get_ViewStyle: TxViewStyle; safecall;
- function Get_Visible: WordBool; safecall;
- function Get_VisibleRowCount: Integer; safecall;
- function GetControlsAlignment: TxAlignment; safecall;
- function GetSearchString: WideString; safecall;
- function IsEditing: WordBool; safecall;
- function IsRightToLeft: WordBool; safecall;
- function StringWidth(const S: WideString): Integer; safecall;
- function UseRightToLeftAlignment: WordBool; safecall;
- function UseRightToLeftReading: WordBool; safecall;
- function UseRightToLeftScrollBar: WordBool; safecall;
- procedure _Set_Font(const Value: IFontDisp); safecall;
- procedure AboutBox; safecall;
- procedure Arrange(Code: TxListArrangement); safecall;
- procedure FlipChildren(AllLevels: WordBool); safecall;
- procedure InitiateAction; safecall;
- procedure Scroll(DX, DY: Integer); safecall;
- procedure Set_AllocBy(Value: Integer); safecall;
- procedure Set_BiDiMode(Value: TxBiDiMode); safecall;
- procedure Set_BorderStyle(Value: TxBorderStyle); safecall;
- procedure Set_Checkboxes(Value: WordBool); safecall;
- procedure Set_Color(Value: OLE_COLOR); safecall;
- procedure Set_ColumnClick(Value: WordBool); safecall;
- procedure Set_Ctl3D(Value: WordBool); safecall;
- procedure Set_Cursor(Value: Smallint); safecall;
- procedure Set_DoubleBuffered(Value: WordBool); safecall;
- procedure Set_DragCursor(Value: Smallint); safecall;
- procedure Set_DragMode(Value: TxDragMode); safecall;
- procedure Set_Enabled(Value: WordBool); safecall;
- procedure Set_FlatScrollBars(Value: WordBool); safecall;
- procedure Set_Font(var Value: IFontDisp); safecall;
- procedure Set_FullDrag(Value: WordBool); safecall;
- procedure Set_GridLines(Value: WordBool); safecall;
- procedure Set_HideSelection(Value: WordBool); safecall;
- procedure Set_HotTrack(Value: WordBool); safecall;
- procedure Set_MultiSelect(Value: WordBool); safecall;
- procedure Set_OwnerData(Value: WordBool); safecall;
- procedure Set_OwnerDraw(Value: WordBool); safecall;
- procedure Set_ParentColor(Value: WordBool); safecall;
- procedure Set_ParentFont(Value: WordBool); safecall;
- procedure Set_ReadOnly(Value: WordBool); safecall;
- procedure Set_RowSelect(Value: WordBool); safecall;
- procedure Set_ShowColumnHeaders(Value: WordBool); safecall;
- procedure Set_SortType(Value: TxSortType); safecall;
- procedure Set_ViewStyle(Value: TxViewStyle); safecall;
- procedure Set_Visible(Value: WordBool); safecall;
- procedure UpdateItems(FirstIndex, LastIndex: Integer); safecall;
- function Get_Items: IListItems; safecall;
- end;
-
- implementation
-
- uses ComObj, About;
-
- { TListViewX }
-
- procedure TListViewX.DefinePropertyPages(DefinePropertyPage: TDefinePropertyPage);
- begin
- { Define property pages here. Property pages are defined by calling
- DefinePropertyPage with the class id of the page. For example,
- DefinePropertyPage(Class_ListViewXPage); }
- end;
-
- procedure TListViewX.EventSinkChanged(const EventSink: IUnknown);
- begin
- FEvents := EventSink as IListViewXEvents;
- end;
-
- procedure TListViewX.InitializeControl;
- begin
- FDelphiControl := Control as TListView2;
- FDelphiControl.OnClick := ClickEvent;
- FDelphiControl.OnDataHint := DataHintEvent;
- FDelphiControl.OnDblClick := DblClickEvent;
- FDelphiControl.OnKeyPress := KeyPressEvent;
- FDelphiControl.OnResize := ResizeEvent;
- FItems := LVItems.TListItems.Create(FDelphiControl.Items);
- end;
-
- function TListViewX.AlphaSort: WordBool;
- begin
- Result := FDelphiControl.AlphaSort;
- end;
-
- function TListViewX.ClassNameIs(const Name: WideString): WordBool;
- begin
- Result := FDelphiControl.ClassNameIs(Name);
- end;
-
- function TListViewX.DrawTextBiDiModeFlags(Flags: Integer): Integer;
- begin
- Result := FDelphiControl.DrawTextBiDiModeFlags(Flags);
- end;
-
- function TListViewX.DrawTextBiDiModeFlagsReadingOnly: Integer;
- begin
- Result := FDelphiControl.DrawTextBiDiModeFlagsReadingOnly;
- end;
-
- function TListViewX.Get_AllocBy: Integer;
- begin
- Result := FDelphiControl.AllocBy;
- end;
-
- function TListViewX.Get_BiDiMode: TxBiDiMode;
- begin
- Result := Ord(FDelphiControl.BiDiMode);
- end;
-
- function TListViewX.Get_BorderStyle: TxBorderStyle;
- begin
- Result := Ord(FDelphiControl.BorderStyle);
- end;
-
- function TListViewX.Get_Checkboxes: WordBool;
- begin
- Result := FDelphiControl.Checkboxes;
- end;
-
- function TListViewX.Get_Color: OLE_COLOR;
- begin
- Result := OLE_COLOR(FDelphiControl.Color);
- end;
-
- function TListViewX.Get_ColumnClick: WordBool;
- begin
- Result := FDelphiControl.ColumnClick;
- end;
-
- function TListViewX.Get_Ctl3D: WordBool;
- begin
- Result := FDelphiControl.Ctl3D;
- end;
-
- function TListViewX.Get_Cursor: Smallint;
- begin
- Result := Smallint(FDelphiControl.Cursor);
- end;
-
- function TListViewX.Get_DoubleBuffered: WordBool;
- begin
- Result := FDelphiControl.DoubleBuffered;
- end;
-
- function TListViewX.Get_DragCursor: Smallint;
- begin
- Result := Smallint(FDelphiControl.DragCursor);
- end;
-
- function TListViewX.Get_DragMode: TxDragMode;
- begin
- Result := Ord(FDelphiControl.DragMode);
- end;
-
- function TListViewX.Get_Enabled: WordBool;
- begin
- Result := FDelphiControl.Enabled;
- end;
-
- function TListViewX.Get_FlatScrollBars: WordBool;
- begin
- Result := FDelphiControl.FlatScrollBars;
- end;
-
- function TListViewX.Get_Font: IFontDisp;
- begin
- GetOleFont(FDelphiControl.Font, Result);
- end;
-
- function TListViewX.Get_FullDrag: WordBool;
- begin
- Result := FDelphiControl.FullDrag;
- end;
-
- function TListViewX.Get_GridLines: WordBool;
- begin
- Result := FDelphiControl.GridLines;
- end;
-
- function TListViewX.Get_HideSelection: WordBool;
- begin
- Result := FDelphiControl.HideSelection;
- end;
-
- function TListViewX.Get_HotTrack: WordBool;
- begin
- Result := FDelphiControl.HotTrack;
- end;
-
- function TListViewX.Get_MultiSelect: WordBool;
- begin
- Result := FDelphiControl.MultiSelect;
- end;
-
- function TListViewX.Get_OwnerData: WordBool;
- begin
- Result := FDelphiControl.OwnerData;
- end;
-
- function TListViewX.Get_OwnerDraw: WordBool;
- begin
- Result := FDelphiControl.OwnerDraw;
- end;
-
- function TListViewX.Get_ParentColor: WordBool;
- begin
- Result := FDelphiControl.ParentColor;
- end;
-
- function TListViewX.Get_ParentFont: WordBool;
- begin
- Result := FDelphiControl.ParentFont;
- end;
-
- function TListViewX.Get_ReadOnly: WordBool;
- begin
- Result := FDelphiControl.ReadOnly;
- end;
-
- function TListViewX.Get_RowSelect: WordBool;
- begin
- Result := FDelphiControl.RowSelect;
- end;
-
- function TListViewX.Get_SelCount: Integer;
- begin
- Result := FDelphiControl.SelCount;
- end;
-
- function TListViewX.Get_ShowColumnHeaders: WordBool;
- begin
- Result := FDelphiControl.ShowColumnHeaders;
- end;
-
- function TListViewX.Get_SortType: TxSortType;
- begin
- Result := Ord(FDelphiControl.SortType);
- end;
-
- function TListViewX.Get_ViewStyle: TxViewStyle;
- begin
- Result := Ord(FDelphiControl.ViewStyle);
- end;
-
- function TListViewX.Get_Visible: WordBool;
- begin
- Result := FDelphiControl.Visible;
- end;
-
- function TListViewX.Get_VisibleRowCount: Integer;
- begin
- Result := FDelphiControl.VisibleRowCount;
- end;
-
- function TListViewX.GetControlsAlignment: TxAlignment;
- begin
- Result := TxAlignment(FDelphiControl.GetControlsAlignment);
- end;
-
- function TListViewX.GetSearchString: WideString;
- begin
- Result := FDelphiControl.GetSearchString;
- end;
-
- function TListViewX.IsEditing: WordBool;
- begin
- Result := FDelphiControl.IsEditing;
- end;
-
- function TListViewX.IsRightToLeft: WordBool;
- begin
- Result := FDelphiControl.IsRightToLeft;
- end;
-
- function TListViewX.StringWidth(const S: WideString): Integer;
- begin
- Result := FDelphiControl.StringWidth(S);
- end;
-
- function TListViewX.UseRightToLeftAlignment: WordBool;
- begin
- Result := FDelphiControl.UseRightToLeftAlignment;
- end;
-
- function TListViewX.UseRightToLeftReading: WordBool;
- begin
- Result := FDelphiControl.UseRightToLeftReading;
- end;
-
- function TListViewX.UseRightToLeftScrollBar: WordBool;
- begin
- Result := FDelphiControl.UseRightToLeftScrollBar;
- end;
-
- procedure TListViewX._Set_Font(const Value: IFontDisp);
- begin
- SetOleFont(FDelphiControl.Font, Value);
- end;
-
- procedure TListViewX.AboutBox;
- begin
- ShowListViewXAbout;
- end;
-
- procedure TListViewX.Arrange(Code: TxListArrangement);
- begin
- FDelphiControl.Arrange(TListArrangement(Code));
- end;
-
- procedure TListViewX.FlipChildren(AllLevels: WordBool);
- begin
- FDelphiControl.FlipChildren(AllLevels);
- end;
-
- procedure TListViewX.InitiateAction;
- begin
- FDelphiControl.InitiateAction;
- end;
-
- procedure TListViewX.Scroll(DX, DY: Integer);
- begin
- FDelphiControl.Scroll(DX, DY);
- end;
-
- procedure TListViewX.Set_AllocBy(Value: Integer);
- begin
- FDelphiControl.AllocBy := Value;
- end;
-
- procedure TListViewX.Set_BiDiMode(Value: TxBiDiMode);
- begin
- FDelphiControl.BiDiMode := TBiDiMode(Value);
- end;
-
- procedure TListViewX.Set_BorderStyle(Value: TxBorderStyle);
- begin
- FDelphiControl.BorderStyle := TBorderStyle(Value);
- end;
-
- procedure TListViewX.Set_Checkboxes(Value: WordBool);
- begin
- FDelphiControl.Checkboxes := Value;
- end;
-
- procedure TListViewX.Set_Color(Value: OLE_COLOR);
- begin
- FDelphiControl.Color := TColor(Value);
- end;
-
- procedure TListViewX.Set_ColumnClick(Value: WordBool);
- begin
- FDelphiControl.ColumnClick := Value;
- end;
-
- procedure TListViewX.Set_Ctl3D(Value: WordBool);
- begin
- FDelphiControl.Ctl3D := Value;
- end;
-
- procedure TListViewX.Set_Cursor(Value: Smallint);
- begin
- FDelphiControl.Cursor := TCursor(Value);
- end;
-
- procedure TListViewX.Set_DoubleBuffered(Value: WordBool);
- begin
- FDelphiControl.DoubleBuffered := Value;
- end;
-
- procedure TListViewX.Set_DragCursor(Value: Smallint);
- begin
- FDelphiControl.DragCursor := TCursor(Value);
- end;
-
- procedure TListViewX.Set_DragMode(Value: TxDragMode);
- begin
- FDelphiControl.DragMode := TDragMode(Value);
- end;
-
- procedure TListViewX.Set_Enabled(Value: WordBool);
- begin
- FDelphiControl.Enabled := Value;
- end;
-
- procedure TListViewX.Set_FlatScrollBars(Value: WordBool);
- begin
- FDelphiControl.FlatScrollBars := Value;
- end;
-
- procedure TListViewX.Set_Font(var Value: IFontDisp);
- begin
- SetOleFont(FDelphiControl.Font, Value);
- end;
-
- procedure TListViewX.Set_FullDrag(Value: WordBool);
- begin
- FDelphiControl.FullDrag := Value;
- end;
-
- procedure TListViewX.Set_GridLines(Value: WordBool);
- begin
- FDelphiControl.GridLines := Value;
- end;
-
- procedure TListViewX.Set_HideSelection(Value: WordBool);
- begin
- FDelphiControl.HideSelection := Value;
- end;
-
- procedure TListViewX.Set_HotTrack(Value: WordBool);
- begin
- FDelphiControl.HotTrack := Value;
- end;
-
- procedure TListViewX.Set_MultiSelect(Value: WordBool);
- begin
- FDelphiControl.MultiSelect := Value;
- end;
-
- procedure TListViewX.Set_OwnerData(Value: WordBool);
- begin
- FDelphiControl.OwnerData := Value;
- end;
-
- procedure TListViewX.Set_OwnerDraw(Value: WordBool);
- begin
- FDelphiControl.OwnerDraw := Value;
- end;
-
- procedure TListViewX.Set_ParentColor(Value: WordBool);
- begin
- FDelphiControl.ParentColor := Value;
- end;
-
- procedure TListViewX.Set_ParentFont(Value: WordBool);
- begin
- FDelphiControl.ParentFont := Value;
- end;
-
- procedure TListViewX.Set_ReadOnly(Value: WordBool);
- begin
- FDelphiControl.ReadOnly := Value;
- end;
-
- procedure TListViewX.Set_RowSelect(Value: WordBool);
- begin
- FDelphiControl.RowSelect := Value;
- end;
-
- procedure TListViewX.Set_ShowColumnHeaders(Value: WordBool);
- begin
- FDelphiControl.ShowColumnHeaders := Value;
- end;
-
- procedure TListViewX.Set_SortType(Value: TxSortType);
- begin
- FDelphiControl.SortType := TSortType(Value);
- end;
-
- procedure TListViewX.Set_ViewStyle(Value: TxViewStyle);
- begin
- FDelphiControl.ViewStyle := TViewStyle(Value);
- end;
-
- procedure TListViewX.Set_Visible(Value: WordBool);
- begin
- FDelphiControl.Visible := Value;
- end;
-
- procedure TListViewX.UpdateItems(FirstIndex, LastIndex: Integer);
- begin
- FDelphiControl.UpdateItems(FirstIndex, LastIndex);
- end;
-
- procedure TListViewX.ClickEvent(Sender: TObject);
- begin
- if FEvents <> nil then FEvents.OnClick;
- end;
-
- procedure TListViewX.DataHintEvent(Sender: TObject; StartIndex,
- EndIndex: Integer);
- begin
- if FEvents <> nil then FEvents.OnDataHint(StartIndex, EndIndex);
- end;
-
- procedure TListViewX.DblClickEvent(Sender: TObject);
- begin
- if FEvents <> nil then FEvents.OnDblClick;
- end;
-
- procedure TListViewX.KeyPressEvent(Sender: TObject; var Key: Char);
- var
- TempKey: Smallint;
- begin
- TempKey := Smallint(Key);
- if FEvents <> nil then FEvents.OnKeyPress(TempKey);
- Key := Char(TempKey);
- end;
-
- procedure TListViewX.ResizeEvent(Sender: TObject);
- begin
- if FEvents <> nil then FEvents.OnResize;
- end;
-
- function TListViewX.Get_Items: IListItems;
- begin
- Result := FItems;
- end;
-
- initialization
- TActiveXControlFactory.Create(ComServer, TListViewX, TListView2,
- Class_ListViewX, 1, '', 0, tmApartment);
- end.
-